package com.tunisair.app.entities;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="AUTORISATIONS")
public class Autorisation {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;
	
	
	private boolean isAuthorizedTo;
	
	@ManyToMany
	@JoinTable(name="AUTORISATION_FONCTION", 
			joinColumns={ @JoinColumn(name="autorisation_id") }, 
			inverseJoinColumns={@JoinColumn(name="fonction_id")})
	private Collection<Fonction> fonctions;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public boolean isAuthorizedTo() {
		return isAuthorizedTo;
	}

	public void setAuthorizedTo(boolean isAuthorizedTo) {
		this.isAuthorizedTo = isAuthorizedTo;
	}

	public Collection<Fonction> getFonctions() {
		return fonctions;
	}

	public void setFonctions(Collection<Fonction> fonctions) {
		this.fonctions = fonctions;
	}

	public Autorisation(Collection<Fonction> fonctions) {
		super();
		this.fonctions = fonctions;
	}
	
	
	

}
